#include "../logs/lgrlog.h"

void test_log()
{
    INFO("%s", "测试开始");
    lgrlog::Logger::ptr logger = lgrlog::getLogger("async_logger");
    logger->debug("%s", "测试日志");
    logger->info("%s", "测试日志");
    logger->warn("%s", "测试日志");
    logger->error("%s", "测试日志");
    logger->fatal("%s", "测试日志");
    INFO("%s", "测试完毕");
}

int main()
{
    std::unique_ptr<lgrlog::LoggerBuilder>builder(new lgrlog::GlobalLoggerBuilder());
    builder->buildLoggerName("sync_logger");
    builder->buildLoggerLevel(lgrlog::LogLevel::value::DEBUG);
    builder->buildFormatter("[%c][%f:%l][%p]%m%n");
    builder->buildLoggerType(lgrlog::LoggerType::LOGGER_SYNC);
    builder->buildSink<lgrlog::StdoutSink>();
    builder->buildSink<lgrlog::FileSink>("./logfile/sync.log");
    builder->buildSink<lgrlog::RollBySizeSink>("./logfile/roll-async-by-size", 1024*1024);
    builder->build();
    test_log();

    return 0;
}